package com.elink.enginerring.blog.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.elink.enginerring.blog.co.BlogCo;
import com.elink.enginerring.blog.dao.BlogMapper;
import com.elink.enginerring.common.ErrorType;
import com.elink.enginerring.common.Pagination;
import com.elink.enginerring.util.JSONUtil;

@Service
public class BlogService  implements IBlogService{
	@Autowired
	private BlogMapper blogMapper;
	
	@Override
	public Map<String, Object> getList(BlogCo co) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("list", blogMapper.selectList(co));
		map.put("pagination", new Pagination(co, blogMapper.selectCount(co)));
		return JSONUtil.getJSON(ErrorType.SUCCESS,map);
	}

	@Override
	public Map<String, Object> getInfo(String blogId,int type) {
		return JSONUtil.getJSON(ErrorType.SUCCESS,blogMapper.getInfo(blogId, type));
	}

}
